import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import 'vuetify/dist/vuetify.min.css'
import 'vuetify/styles'
import 'katex/dist/katex.min.css';
import { createVuetify } from 'vuetify'
import * as components from 'vuetify/components'
import * as directives from 'vuetify/directives'
import { createPinia } from 'pinia'


const pinia = createPinia()
const vuetify = createVuetify({
    components,
    directives,
})

createApp(App).use(vuetify).use(pinia).mount('#app')

const registerServiceWorker = async () => {
    if ("serviceWorker" in navigator) {
      try {
        const registration = await navigator.serviceWorker.register("/sw.js", {
          scope: "/",
        });
        if (registration.installing) {
          console.log("正在安装 Service worker");
        } else if (registration.waiting) {
          console.log("已安装 Service worker installed");
        } else if (registration.active) {
          console.log("激活 Service worker");
        }
      } catch (error) {
        console.error(`注册失败：${error}`);
      }
    }
  };
  
  // …
  
  registerServiceWorker();
  